﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;

namespace DapperHelper.SqlBuilder
{
    public class DeleteBuilder<T> : AbstractSqlBuilder<T>, ICondition<T>
    {
        public IList<string> Conditions { get; }
        
        public DeleteBuilder() : base()
        {
            Conditions = new List<string>();
            SqlBuilder.Append("delete from ").Append(TableName()).Append(" where ");
        }
        
        public void Condition(params Expression<Func<T, bool>>[] expressions)
        {
            foreach (Expression<Func<T, bool>> expr in expressions)
            {
                Conditions.Add(AddCondition(expr));
            }
        }

        public string AddCondition(Expression<Func<T, bool>> expr)
        {
            return String.Empty;
        }


        public override string Build()
        {
            SqlBuilder.Append(string.Join(" and ", Conditions));
            return base.Build();
        }
    }
}